package sau.diyizu.media.bean;

import java.util.concurrent.TimeUnit;

/**
 @author JYD
 @version 1.0
 @since 2020/12/15 22:22 */
public class Music {
    public Integer id;
    public String name;
    public String path;
    public Long duration;
    public String author;
    public Long memorySize;

    public String formatDuration() {
        String timeFormat = duration > TimeUnit.HOURS.toMillis(1)
                ? "%tT"
                : "%1$tM:%1$tS";
        return String.format(timeFormat, duration);
    }
}
